var express = require('express');
var path = require('path');
var cookieParser = require('cookie-parser');
var logger = require('morgan');

var app = express();

app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({
    extended: false
}));
app.use(cookieParser());
app.use("/admin", express.static(path.join(__dirname, './public/admin'))); //通过/admin访问后台
// app.use("/upload", express.static(path.join(__dirname, './public/admin'))) 这个要去掉， 是bug
app.use("/upload", express.static(path.join(__dirname, './public/upload')));
app.use("/", express.static(path.join(__dirname, './public/www'))); //通过/访问前台
app.use("/aaa", express.static(path.join(__dirname, './public/test.html'))); //通过/访问前台

// //在这里注册路由
//文章
//作者：刘婷婷
app.use("/api/Article",require("./routes/Article"))
//电影和影院
//作者：曾泉
app.use("/api/MovieAndCinema", require("./routes/MovieAndCinema"))

//lsc
app.use("/api/Movie",require("./routes/Movie"));//电影
// app.use("/api/Cinema",require("./routes/Cinema"))//影院
// app.use("/api/MovieAndCinema",require("./routes/MovieAndCinema"))//电影和影院
// app.use("/api/Article",require("./routes/Article"))//文章
app.use("/api/Movie",require("./routes/Movie"));
//lsc
//电影上传
app.use("/api/upload",require("./routes/upload"));
//用户
//作者：黄佳
app.use("/api/User",require("./routes/User"))//用户

//作者:唐嘉诚
//注册一个院线的路由
app.use("/api/Cinema",require("./routes/Cinama"))//影院


module.exports = app;